x86, hvm: APIC INIT handling can make use of existing hvm_vcpu_down()
authorKeir Fraser <keir.fraser@citrix.com>
Tue, 15 Apr 2008 15:38:25 +0000 (16:38 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Tue, 15 Apr 2008 15:38:25 +0000 (16:38 +0100)
helper function.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
xen/arch/x86/hvm/hvm.c
xen/arch/x86/hvm/vlapic.c
xen/include/asm-x86/hvm/hvm.h

index 69fe654fa84e466636478b56c8c182e7f7634815..97a1aaa17ca2e494ac83187a5264ba2e5686b828 100644 (file)
@@ -688,14 +688,11 @@ void hvm_vcpu_destroy(struct vcpu *v)
     /*free_xen_event_channel(v, v->arch.hvm_vcpu.xen_port);*/
 }
 
-static void hvm_vcpu_down(void)
+void hvm_vcpu_down(struct vcpu *v)
 {
-    struct vcpu *v = current;
     struct domain *d = v->domain;
     int online_count = 0;
 
-    gdprintk(XENLOG_INFO, "VCPU%d: going offline.\n", v->vcpu_id);
-
     /* Doesn't halt us immediately, but we'll never return to guest context. */
     set_bit(_VPF_down, &v->pause_flags);
     vcpu_sleep_nosync(v);
@@ -710,7 +707,7 @@ static void hvm_vcpu_down(void)
     /* ... Shut down the domain if not. */
     if ( online_count == 0 )
     {
-        gdprintk(XENLOG_INFO, "all CPUs offline -- powering off.\n");
+        gdprintk(XENLOG_INFO, "All CPUs offline -- powering off.\n");
         domain_shutdown(d, SHUTDOWN_poweroff);
     }
 }
@@ -749,7 +746,7 @@ void hvm_hlt(unsigned long rflags)
      * out of this.
      */
     if ( unlikely(!(rflags & X86_EFLAGS_IF)) )
-        return hvm_vcpu_down();
+        return hvm_vcpu_down(current);
 
     do_sched_op_compat(SCHEDOP_block, 0);
 }
index 222b508c9be042b5ddf8b68a6750add246844843..9bfc2cc3d1b7bafafb836ce8d7ee67e93870a576 100644 (file)
@@ -291,8 +291,7 @@ static int vlapic_accept_init(struct vcpu *v)
         return X86EMUL_OKAY;
 
     /* Asynchronously take the VCPU down and schedule reset work. */
-    set_bit(_VPF_down, &v->pause_flags);
-    vcpu_sleep_nosync(v);
+    hvm_vcpu_down(v);
     tasklet_schedule(&vcpu_vlapic(v)->init_tasklet);
     return X86EMUL_RETRY;
 }
index 24080c6cde5039b777fa12eb8e6d34667b528776..aee2b150ae4ecc2c5b8d492600a2d35940fab1b4 100644 (file)
@@ -138,6 +138,7 @@ void hvm_domain_destroy(struct domain *d);
 
 int hvm_vcpu_initialise(struct vcpu *v);
 void hvm_vcpu_destroy(struct vcpu *v);
+void hvm_vcpu_down(struct vcpu *v);
 
 void hvm_send_assist_req(struct vcpu *v);